<?php

error_reporting(E_NONE);

// Twitter's API URL.
define('API_URL','http://api.twitter.com/1/');

// Cookie encryption key. Max 52 characters
define('ENCRYPTION_KEY', 'PLEASE CHANGE THIS KEY!');

// OAuth consumer and secret keys. Available from http://twitter.com/oauth_clients
define('OAUTH_CONSUMER_KEY', 'ENTER TWITTER APP KEY!');
define('OAUTH_CONSUMER_SECRET', 'ENTER TWITTER APP SECRET!');

// bit.ly login and API key for URL shortening
define('BITLY_LOGIN', '');
define('BITLY_API_KEY', '');

// slideshare.com API key and Shared secret for getting Slidesha.re thumbnails. Available from http://www.slideshare.net/developers/applyforapi
define('SLIDESHARE_API_KEY', '');
define('SLIDESHARE_SHARED_SECRET', '');

// Optional API keys for retrieving thumbnails
define('FLICKR_API_KEY', '');

// API key for Twitpic - sign up at http://dev.twitpic.com/
define('TWITPIC_API_KEY', '');

// Optional: Allows you to turn shortened URLs into long URLs http://www.longurlplease.com/docs
// Uncomment to enable.
// define('LONGURL_KEY', 'true');

// Optional: Enable to view page processing and API time
define('DEBUG_MODE', 'OFF');

// Base URL, should point to your website, including a trailing slash
// Can be set manually but the following code tries to work it out automatically.
$https = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off';
$base_url = ($https ? 'https://' : 'http://') .$_SERVER['HTTP_HOST'];
if ($directory = trim(dirname($_SERVER['SCRIPT_NAME']), '/\,')) {
	$base_url .= '/'.$directory;
}
define('BASE_URL', $base_url.'/');


// MySQL storage of OAuth login details for users
// If you use MySQL, change OFF to ON, and enter the MySQL config information
define('MYSQL_USERS', 'OFF');
$msyql_config = array(
    'host'      => 'localhost',
    'username'  => '',
    'password'  => '',
    'database'  => '',
    'tablename' => 'dabra_user',
    'is_connected'  => FALSE
);
function db_query($sql) {
    if (MYSQL_USERS != 'ON') {
        return NULL;
    }
    global $mysql_config;
    if (!$mysql_config['is_connected']) {
        mysql_connect($mysql_config['host'], $mysql_config['username'], $mysql_config['password']) or die('Cannot connect to mysql');
        mysql_select_db($mysql_config['database']) or die('Connot use database ' . $mysql_config['database']);
        $mysql_config['is_connected'] = TRUE;
    }
    return mysql_query($sql);
}

/* The following table is needed to store user login details if you enable MYSQL_USERS:
Modify 'dabra_user' to your value if you modified $mysql_config['tablename']

CREATE TABLE IF NOT EXISTS `dabra_user` (
  `username` varchar(64) NOT NULL,
  `oauth_key` varchar(128) NOT NULL,
  `oauth_secret` varchar(128) NOT NULL,
  `password` varchar(50) NOT NULL,
  `twip_oapi` varchar(40) NOT NULL,
  PRIMARY KEY (`username`)
)

*/

// Google Analytics Mobile tracking code
// You need to download ga.php from the Google Analytics website for this to work
// Copyright 2009 Google Inc. All Rights Reserved.
$GA_ACCOUNT = "";
$GA_PIXEL = "ga.php";

function googleAnalyticsGetImageUrl() {
	global $GA_ACCOUNT, $GA_PIXEL;
	$url = "";
	$url .= $GA_PIXEL . "?";
	$url .= "utmac=" . $GA_ACCOUNT;
	$url .= "&utmn=" . rand(0, 0x7fffffff);
	$referer = $_SERVER["HTTP_REFERER"];
	$query = $_SERVER["QUERY_STRING"];
	$path = $_SERVER["REQUEST_URI"];
	if (empty($referer)) {
		$referer = "-";
	}
	$url .= "&utmr=" . urlencode($referer);
	if (!empty($path)) {
		$url .= "&utmp=" . urlencode($path);
	}
	$url .= "&guid=ON";
	return str_replace("&", "&amp;", $url);
}

?>
